<?php

/**
 * @author      Nguyen Duc Thuan <me@ndthuan.com>
 * @copyright   Copyright (c) 2009 Nguyen Duc Thuan <me@ndthuan.com>
 * @version     $Id: EntryVo.php 12 2009-11-03 03:17:46Z thuan.nguyen $
 */

class EntryVo extends Fete_Model_DataRow
{
    /**
     * @var EntryTable
     */
    protected $_dbTable = null;

    /**
     *
     * @param mixed $value
     * @return EntryVo
     */
    public function &setEntryid($value)
    {
        $this->_values['entryid'] = $value;
        return $this;
    }

    /**
     * @return mixed
     */
    public function getEntryid()
    {
        return isset($this->_values['entryid'])
            ? $this->_values['entryid']
            : null;
    }    /**
     *
     * @param mixed $value
     * @return EntryVo
     */
    public function &setETitle($value)
    {
        $this->_values['e_title'] = $value;
        return $this;
    }

    /**
     * @return mixed
     */
    public function getETitle()
    {
        return isset($this->_values['e_title'])
            ? $this->_values['e_title']
            : null;
    }    /**
     *
     * @param mixed $value
     * @return EntryVo
     */
    public function &setEContent($value)
    {
        $this->_values['e_content'] = $value;
        return $this;
    }

    /**
     * @return mixed
     */
    public function getEContent()
    {
        return isset($this->_values['e_content'])
            ? $this->_values['e_content']
            : null;
    }    /**
     *
     * @param mixed $value
     * @return EntryVo
     */
    public function &setEType($value)
    {
        $this->_values['e_type'] = $value;
        return $this;
    }

    /**
     * @return mixed
     */
    public function getEType()
    {
        return isset($this->_values['e_type'])
            ? $this->_values['e_type']
            : null;
    }    /**
     *
     * @param mixed $value
     * @return EntryVo
     */
    public function &setEStatus($value)
    {
        $this->_values['e_status'] = $value;
        return $this;
    }

    /**
     * @return mixed
     */
    public function getEStatus()
    {
        return isset($this->_values['e_status'])
            ? $this->_values['e_status']
            : null;
    }    /**
     *
     * @param mixed $value
     * @return EntryVo
     */
    public function &setEDatePosted($value)
    {
        $this->_values['e_date_posted'] = $value;
        return $this;
    }

    /**
     * @return mixed
     */
    public function getEDatePosted()
    {
        return isset($this->_values['e_date_posted'])
            ? $this->_values['e_date_posted']
            : null;
    }    /**
     *
     * @param mixed $value
     * @return EntryVo
     */
    public function &setEDateExpire($value)
    {
        $this->_values['e_date_expire'] = $value;
        return $this;
    }

    /**
     * @return mixed
     */
    public function getEDateExpire()
    {
        return isset($this->_values['e_date_expire'])
            ? $this->_values['e_date_expire']
            : null;
    }    /**
     *
     * @param mixed $value
     * @return EntryVo
     */
    public function &setEAuthor($value)
    {
        $this->_values['e_author'] = $value;
        return $this;
    }

    /**
     * @return mixed
     */
    public function getEAuthor()
    {
        return isset($this->_values['e_author'])
            ? $this->_values['e_author']
            : null;
    }

    /**
     *
     * @return EntryVo
     */
    public function &save()
    {
        if (null !== $this->_values['entryid']) {
            $id = $this->_values['entryid'];
            unset($this->_values['entryid']);
            $this->getDbTable()->update($this->_values,
                "entryid = '" . mysql_escape_string($id) . "'");
        } else {
            $this->getDbTable()->insert($this->_values);
        }

        return $this;
    }

    /**
     * @param EntryTable $table
     * @return EntryVo
     */
    public function &setDbTable(EntryTable $table)
    {
        $this->_dbTable = $table;
        return $this;
    }

    /**
     *
     * @return EntryTable
     */
    public function &getDbTable()
    {
        if (null === $this->_dbTable) {
            $this->_dbTable = new EntryTable();
        }

        return $this->_dbTable;
    }

    /**
     *
     * @param mixed $var
     * @return EntryVo
     */
    static public function genInstance()
    {
        return new self();
    }
}